/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - core/math
// Copyright (c) 2014.  All Rights Reserved
//
// File:		AEEulerUtil.h
// Author:		Gianluca Belardelli
// Date:		31/07/2013
// Purpose:		Implementazione dei metodi inline della classe AEEulerUtil
//
// Revision:
//				001 - 31/07/2013
//					+ Revisione iniziale
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AEEULERUTIL_INL_
#define _AEEULERUTIL_INL_

//#include <core/math/quaternion/AEQuaternion.h>

AE_FORCEINLINE AEMatrix3 AEEulerUtil::ConvertEulerToMat3_Deg( float fRotation1, float fRotation2, float fRotation3, AEEulerMode::Enum EulerMode )
{
	return ConvertEulerToMat3_Rad( AEMath::Degrees2Radians( fRotation1 ), AEMath::Degrees2Radians( fRotation2 ), AEMath::Degrees2Radians( fRotation3 ), EulerMode );
}

AE_FORCEINLINE AEMatrix4 AEEulerUtil::ConvertEulerToMat4_Rad( float fRotation1, float fRotation2, float fRotation3, AEEulerMode::Enum EulerMode )
{
	return AEMatrix4( ConvertEulerToMat3_Rad( fRotation1, fRotation2, fRotation3, EulerMode ), AEVector3( 0.0f ) );
}

AE_FORCEINLINE AEMatrix4 AEEulerUtil::ConvertEulerToMat4_Deg( float fRotation1, float fRotation2, float fRotation3, AEEulerMode::Enum EulerMode )
{
	return AEMatrix4(
			ConvertEulerToMat3_Rad(
					AEMath::Degrees2Radians( fRotation1 ),
					AEMath::Degrees2Radians( fRotation2 ),
					AEMath::Degrees2Radians( fRotation3 ),
					EulerMode
					),
			AEVector3( 0.0f )
			);
}


AE_FORCEINLINE void AEEulerUtil::ConvertQuaternionToEuler_Deg( const AEQuaternion &qtIn, float &fRotation1, float &fRotation2, float &fRotation3, AEEulerMode::Enum EulerMode )
{
	ConvertQuaternionToEuler_Rad( qtIn, fRotation1, fRotation2, fRotation3, EulerMode );
	
	fRotation1 = AEMath::Radians2Degrees( fRotation1 );
	fRotation2 = AEMath::Radians2Degrees( fRotation2 );
	fRotation3 = AEMath::Radians2Degrees( fRotation3 );
}

AE_FORCEINLINE void AEEulerUtil::ConvertMat3ToEuler_Deg( const AEMatrix3 &matIn, float &fRotation1, float &fRotation2, float &fRotation3, AEEulerMode::Enum EulerMode )
{
	ConvertMat3ToEuler_Rad( matIn, fRotation1, fRotation2, fRotation3, EulerMode );
	
	fRotation1 = AEMath::Radians2Degrees( fRotation1 );
	fRotation2 = AEMath::Radians2Degrees( fRotation2 );
	fRotation3 = AEMath::Radians2Degrees( fRotation3 );
}

AE_FORCEINLINE void AEEulerUtil::ConvertMat4ToEuler_Rad( const AEMatrix4 &matIn, float &fRotation1, float &fRotation2, float &fRotation3, AEEulerMode::Enum EulerMode )
{
	ConvertMat3ToEuler_Rad( matIn.GetRotationalPart(), fRotation1, fRotation2, fRotation3, EulerMode );
}

AE_FORCEINLINE void AEEulerUtil::ConvertMat4ToEuler_Deg( const AEMatrix4 &matIn, float &fRotation1, float &fRotation2, float &fRotation3, AEEulerMode::Enum EulerMode )
{
	ConvertMat3ToEuler_Rad( matIn.GetRotationalPart(), fRotation1, fRotation2, fRotation3, EulerMode );
	
	fRotation1 = AEMath::Radians2Degrees( fRotation1 );
	fRotation2 = AEMath::Radians2Degrees( fRotation2 );
	fRotation3 = AEMath::Radians2Degrees( fRotation3 );
}

AE_FORCEINLINE AEQuaternion AEEulerUtil::ConvertEulerToQuaternion_Deg( float fRotation1, float fRotation2, float fRotation3, AEEulerMode::Enum EulerMode )
{
	return ConvertEulerToQuaternion_Rad(
				AEMath::Degrees2Radians( fRotation1 ),
				AEMath::Degrees2Radians( fRotation2 ),
				AEMath::Degrees2Radians( fRotation3 ),
				EulerMode
				);
}

#endif
// _AEEULERUTIL_INL_
